<?php include_once './application/views/sys_admin/common/header.php';  ?>
<form id="reply_form">
<input type="hidden" name="act"  value="submit"/>

<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once './application/views/sys_admin/common/user_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
			<strong>客户管理</strong> &gt;&gt;  留言
		</div>
		
		<div class="admin_right_info">
			<div class="admin_right_info_title"><h2>留言</h2></div>
			<ul>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">标题：</div>
					<input type="hidden" id="leave_word_id" name="leave_word_id" value="<?php echo $leaveword['id'];?>"/>
					<div class="admin_right_info_tr admin_right_info_m">
					<?php echo $leaveword['title'];?>
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="titleTip"></div> </div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">内容：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<?php echo $leaveword['content'];?>
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="urlTip"></div> </div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">时间：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<?php echo date('Y-m-d H:i',$leaveword['ftime']);?>
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="fgroupTip"></div></div>
				</li>
			</ul>
			<div class="admin_right_info_title"><h2>回复</h2></div>
			<ul>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">回复内容：</div>
					<div class="admin_right_info_tr admin_right_info_m">
						   <textarea rows="6" cols="35" name="reply_content" id="reply_content"><?php echo $leaveword['reply_content'];?></textarea>
					</div>
					<div class="admin_right_info_tr admin_right_info_r"><div id="replyCotent"></div> </div>
				</li>
			</ul>
			<div class="admin_right_info_title" style="margin-top:20px;"><h2></h2></div>
			</div>
			
			<div class="user_right_border">
			<div class="c">
				<input type="button" size="30" value="回复留言" onclick="replyLeaveword();"/>
			</div>
		</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->
</form>
<script>
function replyLeaveword(){
	var id = $("#leave_word_id").val();
	var options = {
		url : '/sys_admin/leaveword/reply_leaveword/'+id,
		clearForm :true,
		resetForm :true,
		beforeSubmit:  checkForm,
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg==''){
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}},
					close: function() {
						if(ret.url==''){
							window.location.reload();
						}else{
							location=ret.url;
						}
					}
				}); 
				$("#msg").html("操作成功");
			}else{
				$('#dialog').dialog({
					modal:true,
					title:'系统提示',
					buttons:{"确定":function(){$(this).dialog("close");}}
				}); 
				$("#msg").html(ret.msg);
			}
		}
	};
	$("#reply_form").ajaxSubmit(options);
	return false;
}

function checkForm(){
	var err = '';
	if($('#reply_content').val().trim()==''){
		err = '请输入回复内容';
	}
	if(err==''){
		return true;
	}else{
		$('#dialog').dialog({
			modal:true, //蒙层（弹出会影响页面大小）
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}}
		}); 
		$("#msg").html(err);
		return false;
	}
}
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
</body>
</html>
